home *** CD-ROM | disk | FTP | other *** search
Modula Implementation | 1997-01-08 | 1.6 KB | 42 lines | [TEXT/3PRM] |
- implementation module scrap;
-
- import mac_types, StdArray;
-
- NoScrapErr :== -100; // desk scrap isn't initialized
- NoTypeErr :== -102; // no data of the requested type
-
- ScrapSize :== 2400; // $960 (Long) size in bytes of desk scrap
- ScrapHandle :== 2404; // $964 (Long) handle to desk scrap in memory
- ScrapCount :== 2408; // $968 (Word) count changed by ZeroScrap
- ScrapState :== 2410; // $96A (Word) tells where desk scrap is
- ScrapName :== 2412; // $96C (Sting256) pointer to scrap filename (preceded by length byte)
-
- TextResourceType :== 0x54455854; // 'TEXT'
- PictResourceType :== 0x50494354; // 'PICT'
-
- // Writing to the Desk Scrap
- ZeroScrap :: !Toolbox -> (!Int,!Toolbox);
- ZeroScrap tb = code (tb=R4U)(result=L,z=Z){
- instruction 0xA9FC | _ZeroScrap
- };
-
- PutScrap :: !Int !Int !Ptr !Toolbox -> (!Int,!Toolbox);
- PutScrap length theType source tb = code (length=R4L,theType=L,source=L,tb=U)(result=L,z=Z){
- instruction 0xA9FE | _PutScrap
- };
-
- PutScrapText :: !{#Char} !Toolbox -> (!Int,!Toolbox);
- PutScrapText sourceText tb = PutScrapText1 (size sourceText) TextResourceType sourceText tb;
-
- PutScrapText1 :: !Int !Int !{#Char} !Toolbox -> (!Int,!Toolbox);
- PutScrapText1 length theType sourceText tb = code (length=R4L,theType=L,sourceText=S,tb=U)(result=L,z=Z){
- instruction 0x52AF 0x0000 | addq.l #1,0(sp)
- instruction 0xA9FE | _PutScrap
- };
-
- // Reading from the Desk Scrap
- GetScrap :: !Handle !Int !Toolbox -> (!Int,!Int,!Toolbox);
- GetScrap hDest theType tb = code (hDest=R8L,theType=L,tb=O12U)(result=L,offset=L,z=Z){
- instruction 0xA9FD | _GetScrap
- };
-